package com.wyzz.hr.base.wf;

import java.util.ArrayList;
import java.util.List;

import com.wyzz.hr.base.BaseAction;
import com.wyzz.hr.bo.IPositionBo;
import com.wyzz.hr.bo.IWorkFlowApproverBo;
import com.wyzz.hr.pojo.Position;
import com.wyzz.hr.pojo.WorkFlowApprover;
import com.wyzz.hr.spring.SpringBeanFactory;
import com.wyzz.hr.vo.WorkFlowApproverBean;

public abstract class AbstractWfConfigAction extends BaseAction {

	public AbstractWfConfigAction() {
		nodeList = new ArrayList();
		workFlowApproverBo = (IWorkFlowApproverBo) getBean("workFlowApproverBo");
	}

	public String workFlowConfig() {
		IPositionBo positionBo = (IPositionBo) SpringBeanFactory
				.getBean("positionBo");
		nodeList = positionBo.getPositionTreeListNode();
		return "success";
	}

	public String workFlowShow() {
		return "success";
	}

	public abstract List formatList(Position position, List list);

	public abstract String update();

	public abstract String workFlowList();

	public WorkFlowApproverBean newWorkFlowApproverBean(Position position,
			String type) {
		WorkFlowApproverBean bean = new WorkFlowApproverBean();
		bean.setId(type);
		bean.setDescription(position.getPositionPbId().getPbName());
		bean.setDeptName(position.getPositionPbId().getPbDeptId()
				.getDepartmentName());
		if (position.getPositionEmpNo() != null)
			bean.setName(position.getPositionEmpNo().getEmpName());
		return bean;
	}

	public WorkFlowApprover newWorkFlowApprover(Position position, String type) {
		WorkFlowApprover wf = new WorkFlowApprover();
		wf.setWorkFlowApproverType(type);
		wf.setWorkFlowApproverId(position.getId());
		wf.setWorkFlowApproverInd(Integer.valueOf(2));
		return wf;
	}

	public String getPositionId() {
		return positionId;
	}

	public void setPositionId(String positionId) {
		this.positionId = positionId;
	}

	public List getItems() {
		return items;
	}

	public void setItems(List items) {
		this.items = items;
	}

	public List getNodeList() {
		return nodeList;
	}

	public void setNodeList(List nodeList) {
		this.nodeList = nodeList;
	}

	public List getAuthList() {
		return authList;
	}

	public void setAuthList(List authList) {
		this.authList = authList;
	}

	public List getLocationList() {
		return locationList;
	}

	public void setLocationList(List locationList) {
		this.locationList = locationList;
	}

	public String getPositionName() {
		return positionName;
	}

	public void setPositionName(String positionName) {
		this.positionName = positionName;
	}

	public IWorkFlowApproverBo getWorkFlowApproverBo() {
		return workFlowApproverBo;
	}

	public void setWorkFlowApproverBo(IWorkFlowApproverBo workFlowApproverBo) {
		this.workFlowApproverBo = workFlowApproverBo;
	}

	public String getPageType() {
		return pageType;
	}

	public void setPageType(String pageType) {
		this.pageType = pageType;
	}

	private static final long serialVersionUID = 1L;
	protected String positionId;
	protected List items;
	protected List nodeList;
	protected List authList;
	protected List locationList;
	protected String positionName;
	protected IWorkFlowApproverBo workFlowApproverBo;
	public String pageType;
}
